<script>
	
	import QQMapWX from 'lib/qqmap-wx-jssdk/qqmap-wx-jssdk.min.js';
	import Map from 'js_sdk/ms-openMap/openMap.js'
	import { UserLogin,apiGetUserInfo ,GetLoginMobile, UserInfoUpDate} from './apis/index.js';
	import { apiGetMemberInfo,apiMemberUpdate} from './apis/my.js';
	import http from '@/utils/request/http.js';
	import env from '@/env/index.js';
	var qqmapsdk = new QQMapWX({
		key: 'IYIBZ-3DC6U-HRYVF-2E3CJ-OSJDS-E5FDF' 
	});
	let fm = wx.getFileSystemManager(); //本地项目管理
	var platfrom;
	var {BASE_URL , BACKEND_URL } = env;

	export default {
		
		globalData:　{
			IndexType:0,
			orderType:0,
			isFlagFree:false,//判断是否从9.9页面跳转来对
			accessToken:'',
			
			isLoginFlag:false,
			inviteIndexflag:false,
			
			latitude:'22.543541',
			longitude:'114.057969',
			district:'',
			platfrom:platfrom,
			titleBarHeight:0,
			topScroll:0,
			statusBarHeight:0,
			menuButtonInfo:{},
			mineInfo:{}, //个人信息
			navBarHeight:0,
			windowHeight:0,
			bottomTabbar:0,
			inviteId:'',
			BASE_URL,
			baseUrl:BASE_URL,
			appId:'wx3b5828fe62b72a24',
			api:{
				// 获取商品详情
				GetGoodsDetail : BASE_URL + '/api/store/v1/goods', //+ id
				// 获取商品评价
				GetGoodsComment : BASE_URL + '/api/order/v1/goods/comment/list',
				// 获取商品订单详情
				GetGoodsOrderDetail : BASE_URL + '/api/order/v1/goods/detail',
				// 获取活动列表
				GetActivityList : BASE_URL + '/api/platform/v1/activity/list',///{date}
				// 活动详情
				GetActivityDetail : BASE_URL + '/api/platform/v1/activity/view',///{id}
				// 报名/取消报名活动
				JoinActivity:BASE_URL + '/api/platform/v1/activity/join', // id
				// 首页预约
				BookingIndex:BASE_URL + '/api/v1/user/home', // id
				// 每周更新
				WeekNewStore:BASE_URL + '/api/store/v1/newest',
				// 免单商家
				freeAdmissionStore:BASE_URL + '/api/store/v1/free',
				// 广告
				AdIndexList:BASE_URL + '/api/v1/banners/list',
				// 获取预约最多对前十商家
				PopularityList:BASE_URL + '/api/store/v1/popularity',
				// 用户已报名活动
				JoinActivityList : BASE_URL + '/api/platform/v1/activity/me',
				// 类型列表
				TypeList : BASE_URL + '/api/store/v1/store/types',
				// 活动点赞
				ActivityLike: BASE_URL + '/api/platform/v1/activity/like', ///{id}
				// 收藏列表
				FavoritesList: BASE_URL + '/api/user/v1/favorites/list',
				// 用户收藏
				AddFavorites : BASE_URL + '/api/user/v1/favorites/add',
				// 取消收藏
				CancelFavorites : BASE_URL + '/api/user/v1/favorites/remove',
				// Q&A
				QuestionAnswer : BASE_URL + '/api/platform/v1/question/answer/list',//  问答
				// 小程序码
				QrCode : BASE_URL + '/api/user/v1/qrCode',// 小程序码生成
				// 小程序id获取资源信息
				QrcodeSource: BASE_URL + '/api/user/v1/qrCode/source',//
				setting:{
					TrackEvent: BASE_URL + '/api/user/v1/embedding/point/add', //埋点
				},
				// 商户
				store : {
					StoreAppointmentTime: BASE_URL + '/api/store/v1/appointment/times',// 商户预约时间
					GetUserComment : BASE_URL + '/api/store/v1/appointment/conment/list',//商户评论列表
					UpdateBookingTime: BASE_URL + '/api/store/v1/appointment/update',//修改预约时间
					SearchTip: BASE_URL + '/api/v1/searchTip/type',//首页文字信息
					StoreDetail: BASE_URL + '/api/store/v1/detail',//商户详情
				},
				system:{
					bannerSystem : BASE_URL + '/api/platform/v1/banners' ,// location banner 配置	 index me
					popupsSystem: BASE_URL + '/api/platform/v1/popups',// location //弹窗配置
				},
				// 搜索
				search:{
					SearchLog : BASE_URL + '/api/user/v1/search/log/add',//搜索日志
					HotSearchWords : BASE_URL + '/api/user/v1/search/log/hot',//热门搜索
					SearchLast : BASE_URL + '/api/user/v1/search/log/last',// 搜索历史
					ClearSearch : BASE_URL + '/api/user/v1/search/log/clear',//清空历史搜索
					HotSearchStore : BASE_URL + '/api/store/v1/search/hot',// 大家都爱去
				},
				// activity
				activity:{
					ActivityList: BASE_URL + '/api/platform/v1/activity/list' ,////{category} //latest 最新,fellow 关注,me 我参加的活动,release 我发布的活动
					ActivityDetail: BASE_URL + '/api/platform/v1/activity/view',// id 
					ActivityRelease : BASE_URL + '/api/platform/v1/activity/release',//发布活动
					FollowMaster : BASE_URL + '/api/platform/v1/activity/master/follow',//关注/取消关注达人
					IsVerify : BASE_URL + '/api/v1/user/verifyCard/status', //是否实名认证
					VerifyCard : BASE_URL + '/api/v1/user/verifyCard', //实名认证信息
					MasterCreate:BASE_URL +'/api/platform/v1/activity/master/create',//成为达人
					JoinInfo: BASE_URL + '/api/platform/v1/activity/join/Info'//{id}'//报名后活动参加信息
				},
				
				// 教练
				coach:{
					coachList : BASE_URL + '/api/coach/v1/home/list',// 教练列表
					coachDetail : BASE_URL + '/api/coach/v1/home/detail',//教练详情
					courseList : BASE_URL + '/api/coach/v1/course/home/list',// 教练课程
					courseDetail : BASE_URL + '/api/coach/v1/course/home/detail',//教练课程详情
				}
			}
		},
		
		onHide:function(e){
			if(!uni.getStorageSync('wx')){
				uni.removeStorageSync('xiuXianSaleId');
				console.log('退出退出退出退出')
			}
			console.log("执行apponHide")
			setTimeout(function() {
				console.log('2秒钟之后执行了')
				uni.removeStorageSync('wx');
			},2000)
		},
		onLoad(){
			
			uni.hideTabBar();
		},
		onLaunch: function(e) {
			console.log(e)
			let that = this;
			that.autoUpdate();
			uni.setStorageSync('accessToken','')
			uni.hideTabBar();
			// console.log('App Launch',e);
			uni.setStorageSync('enterScene', e.scene);
			this.globalData.windowHeight = uni.getSystemInfoSync().windowHeight; // 页面scrollview高度
			this.globalData.bottomTabbar = uni.getSystemInfoSync().screenHeight - uni.getSystemInfoSync().safeArea.bottom;
			uni.setStorageSync('bottomTabbar', this.globalData.bottomTabbar>0?this.globalData.bottomTabbar:6);
		},  
		
		onShow: function() {
			uni.hideTabBar();
			this.globalData.statusBarHeight = uni.getSystemInfoSync().statusBarHeight; // 状态栏高度
			// 胶囊导航栏高度
			this.globalData.titleBarHeight = (uni.getMenuButtonBoundingClientRect().top - this.globalData.statusBarHeight) * 2 +uni.getMenuButtonBoundingClientRect().height;
			this.globalData.topScroll = this.globalData.statusBarHeight + this.globalData.titleBarHeight; // 状态栏高度+胶囊导航栏高度
			// 自定义导航栏内容
			this.globalData.menuButtonInfo = uni.getMenuButtonBoundingClientRect(); // 胶囊导航栏高度具体数值
			this.globalData.navBarHeight = uni.getMenuButtonBoundingClientRect().height +  (uni.getMenuButtonBoundingClientRect().top - uni.getSystemInfoSync().statusBarHeight) * 2
			this.globalData.windowHeight = uni.getSystemInfoSync().windowHeight; // 页面scrollview高度
			this.globalData.bottomTabbar = uni.getSystemInfoSync().screenHeight - uni.getSystemInfoSync().safeArea.bottom;
			uni.setStorageSync('bottomTabbar', this.globalData.bottomTabbar>0?this.globalData.bottomTabbar:6);
		},
		
		
		methods:{
			
			// 获取海报弹窗配置
			ShowPosterInfo(local,channel){
				let that = this;
				return new Promise((resolve, reject) => {
					that.httpRequest({
						url:that.globalData.api.system.popupsSystem, //AdIndexList,
						method:'POST',
						data:{
							location: local,
							channel:channel
						}
					}).then(result => {
						if(result.code){
							switch(result.code){
								case 200:
									resolve(result.data);
								break;
								default:
									uni.showToast({
										title:fail.message,
										icon:"none"
									})
								break;
							}
						}else{
							resolve(result.data);
						}
					}).catch( fail => {
						uni.showToast({
							title:fail.message,
							icon:"none"
						})
					})
				})
			},
			PosterJumpPage(poster){
				switch(poster.sourceType){
					case 3:
						uni.setStorageSync('webUrl',poster.sourceUrl);
						uni.navigateTo({
							url:'/pages/agreement/agreement'
						})
					break;
					default:
						switch(poster.sourceUrl){
							case "/pages/index/index":
							case "/pages/mine/mine":
							case "/pages/activityCenter/activityCenter":
								uni.switchTab({
									url:poster.sourceUrl
								})
							break;
							case "/pages/activityDetail/activityDetail":
								uni.navigateTo({
									url:poster.sourceUrl + '?activityId=' + poster.sourceId
								})
							break;
							case "/pages/storeDetail/storeDetail":
								uni.navigateTo({
									url:poster.sourceUrl + '?store_id=' + poster.sourceId
								})
							break;
							case "/pages/groupDetail/groupDetail":
								uni.navigateTo({
									url:poster.sourceUrl + '?id=' + poster.sourceId
								})
							break;
							default:
								uni.navigateTo({
									url:poster.sourceUrl
								})
							break;
						}
					break;
				}
			},
			QrcodeSource(id){
				let that = this;
				return new Promise((resolve, reject) => {
					that.httpRequest({
						url:that.globalData.api.QrcodeSource,
						data:{id:id,}
					}).then(result => {
						resolve(result.data);
					}).catch( fail => {
						uni.showToast({
							title:fail.message,
							icon:"none"
						})
					})
				})
			},
			// 接入微信客服
			WeixinServer(){
				wx.openCustomerServiceChat({
					extInfo: {
						url: 'https://work.weixin.qq.com/kf/' + "kfc11f5184d7762c658"
					},
					 corpId: 'ww106853c8ad050781',
				})
			},
			
			GetQrCode(parms){
				let that = this;
				return new Promise((resolve, reject) => {
					that.httpRequest({
						url:that.globalData.api.QrCode,
						data:parms,
					}).then(qrCode => {
						resolve(qrCode.data);
					}).catch( fail => {
						uni.showToast({
							title:fail.message,
							icon:"none"
						})
					})
				})
			},
			// 点击收藏
			addFavorites(item){
				let that = this;
				//取消收藏
				if(item.isFavorites){ 
					that.httpRequest({
						url:that.globalData.api.CancelFavorites,
						data:{
							type:item.type,
							sourceId : item.id
						}
					}).then( cancelFavoritesResult => {
						uni.showToast({
							title:cancelFavoritesResult.code==200?'取消收藏':cancelFavoritesResult.message,
							icon:"none"
						})
					}).catch( cancelFavoritesFail => {
						uni.showToast({
							title:cancelFavoritesFail.errMsg,
							icon:"none"
						})
					})	
				}else{
					// 添加收藏
					that.httpRequest({
						url:that.globalData.api.AddFavorites,
						data:{
							type:item.type,
							sourceId : item.id
						}
					}).then( addFavoritesResult => {//找到指定元素
						uni.showToast({
							title:addFavoritesResult.code==200?'收藏成功':addFavoritesResult.message,
							icon:"none"
						})
					}).catch( addFavoritesFail => {
						uni.showToast({
							title:addFavoritesFail.errMsg,
							icon:"none"
						})
					})
				}
			},
			httpRequest(options){
				var headerObj ;
				if(uni.getStorageSync('accessToken')){
					headerObj = { 
						Authorization:uni.getStorageSync('accessToken') 
					};
				}else{
					headerObj = {'content-type': "application/json"};
				}
				return new Promise((resolve, reject) => {
					uni.request({
						url:  options.url || '',
						data: options.data || {},
						method: options.method || 'POST',
						// header:app.globalData.accessToken? {'Authorization': app.globalData.accessToken} : {'content-type': "application/json"},
						header: headerObj,
						// responseType:options.responseType || "",
						success (res) {
							if(res.statusCode === 200){
								if(res.data.code){
									switch(res.data.code){
										case 200:
											resolve(res.data);
										break;
										default:
											reject(res.data)
											uni.showToast({
												title: res.data.message,
												icon:'none',
												duration:2000
											})
										break;
									}
								}else {
									resolve(res.data);
								}
							}else{
								uni.showToast({
									title: res.errMsg,
									icon:'none'
								})
							};
						},
						fail (res) {
							console.error(res,'error请求失败')
							reject(res);
						}
					})
				})
			},
		
			// 版本更新
			autoUpdate: function() {
			    var that = this;
			    // 获取小程序更新机制兼容
				const updateManager = uni.getUpdateManager();
				updateManager.onCheckForUpdate(function (res) {
					  // 请求完新版本信息的回调
					if(res.hasUpdate){ // 检测到新版本
						updateManager.onUpdateReady(function (res) {
							uni.showModal({
								title: '更新提示',
								content: '新版本已经准备好，是否重启应用？',
								success(res) {
									if (res.confirm) {
									// 新的版本已经下载好，调用 applyUpdate 应用新版本并重启
										updateManager.applyUpdate();
									}
								}
							});
						});
						updateManager.onUpdateFailed(function (res) {
							// 新的版本下载失败
							uni.showToast({
								title:'新版本下载失败，请检查网络',
								icon:'none',
								duration:2000
							})
						});
					}
				});
			},
		
			getLocation(){
				let that = this;
				return new Promise((resolve, reject) => {
					uni.authorize({
						scope: 'scope.userLocation',
						success(auth) {
							// console.log(111,"auth",auth)
							
							uni.getLocation({
								type:'gcj02', //  wgs84
								geocode:true,
								success(res) {
									// console.log(res,"333")
									var latitude = res.latitude
									var longitude = res.longitude
									var speed = res.speed
									var accuracy = res.accuracy
									qqmapsdk.reverseGeocoder({
										location: {
											latitude: latitude,
											longitude: longitude
										},
										success(loc) {
											// console.log(loc.result,"555")
											// console.log(loc,'腾讯地图解析')
											that.globalData.longitude = loc.result.location.lng;
											that.globalData.latitude = loc.result.location.lat;
											that.district = loc.result.ad_info.district;
											resolve(loc)
										},
										fail(fail){
											console.log(fail,'定位失败')
											uni.showToast({
												title: '定位失败，无法获取附近店铺',
												icon:'none',
												duration: 2000
											});
											that.globalData.latitude= 22.543541;
											that.globalData.longitude = 114.057969;
											let locations = {
												lat:22.543541,
												lng:114.057969
											}
											reject(locations)
										},
									});	
								},
								fail(fa) {
									console.log(fa,"4444")
									that.globalData.latitude= 22.543541;
									that.globalData.longitude = 114.057969;
									let locations = {
										lat:22.543541,
										lng:114.057969
									}
									reject(locations)
									// uni.showToast({
									// 	title:'定位失败，请在系统设置中打开定位服务',
									// 	icon:'none',
									// 	duration:2000
									// })
								}
							});
							
						},
						fail(failed) {
							// console.log(222)
							console.log(failed,'授权失败 拒绝授权')
							// that.globalData.latitude= 22.543541;
							// that.globalData.longitude = 114.057969;
							// let locations = {
							// 	lat:22.543541,
							// 	lng:114.057969
							// }
							uni.showModal({
								title:'请允许定位',
								content:'请允许“下楼休闲吧”使用您的定位，方便为您寻找最近的门店',
								cancelText:'取消',
								confirmText:"开启定位",
								success(open) {
									if(open.confirm){
										uni.openSetting({
											success(opensetting){
												console.log(opensetting.authSetting);
												if(opensetting.authSetting['scope.userLocation']){
													uni.getLocation({
														type:'gcj02', //  wgs84
														geocode:true,
														success: function (res) {
															var latitude = res.latitude
															var longitude = res.longitude
															var speed = res.speed
															var accuracy = res.accuracy
															qqmapsdk.reverseGeocoder({
																location: {
																	latitude: latitude,
																	longitude: longitude
																},
																success(loc) {
																	console.log(loc,'腾讯地图解析')
																	that.globalData.longitude = loc.result.location.lng;
																	that.globalData.latitude = loc.result.location.lat;
																	that.district = loc.result.ad_info.district;
																	resolve(loc)
																},
																fail(fail){
																	uni.showToast({
																		title: '定位失败，无法获取附近店铺',
																		icon:'none',
																		duration: 2000
																	});
																	that.globalData.latitude= 22.543541;
																	that.globalData.longitude = 114.057969;
																	let locations = {
																		lat:22.543541,
																		lng:114.057969
																	}
																	reject(locations)
																},
															});	
														},
														fail(fa) {
															that.globalData.latitude= 22.543541;
															that.globalData.longitude = 114.057969;
															let locations = {
																lat:22.543541,
																lng:114.057969
															}
															reject(locations)
															// uni.showToast({
															// 	title:'定位失败，请在系统设置中打开定位服务',
															// 	icon:'none',
															// 	duration:2000
															// })
														}
													});
												}else{
													that.globalData.latitude= 22.543541;
													that.globalData.longitude = 114.057969;
													let locations = {
														lat:22.543541,
														lng:114.057969
													}
													reject(locations)
												}
											}
										})
									}else {
										that.globalData.latitude= 22.543541;
										that.globalData.longitude = 114.057969;
										let locations = {
											lat:22.543541,
											lng:114.057969
										}
										reject(locations)
									}
								}
							})
							// reject(locations)
							// uni.showToast({
							// 	// title:'无法获取到当前位置，请打开位置授权',
							// 	title:'拒绝授权无法获取到位置，请打开位置授权',
							// 	icon:'none',
							// 	duration:2000
							// })
						}
					})
				});
			},
			// 小程序授权获取用户手机号
			GetMobile(e,resolve){
				console.log(e,'授权手机号')
				var that = this;
				if(e.detail.encryptedData && e.detail.iv) {//允许授权  
					apiMemberUpdate({
						encryptedData: e.detail.encryptedData,
						iv: e.detail.iv,
					}).then(pres => {
						console.log(pres,'授权手机号')
						// 授权成功
						if(pres.code!== 0){
							uni.showToast({
								title:pres.message,
								icon:'none',
								duration:2000
							})
						}else{
							resolve(pres)
						}
					})	
				} else {//用户拒绝授权
					uni.showToast({
						title: "手机号为您的会员身份，请授权",
						icon:"none",
						duration: 2000
					})
					return;
					//拒绝授权后弹出一些提示  
				}
			},
			//  小程序登录
			isLogin(parms,resolve){
				let that = this;
				let data ={};
				let accessToken =  uni.getStorageSync('accessToken');
				let mineInfo =  uni.getStorageSync('mineInfo');
				// 判断登陆信息
				uni.login({
					success: function(lRes) {
						console.log(lRes,"lReslRes",parms)
						if(parms.userId || parms.productId){
							data = {
								code: lRes.code,
								userId:parms.userId?Number(parms.userId):'',
								productId:parms.productId?Number(parms.productId):'',
							}
						} else {
							if(parms.invite_code){
								data = {
									invite_code:parms.invite_code,
									code: lRes.code,
								}
							}else{
								data = {
									code: lRes.code,
								}
							}
						}
						
						console.log(data,"data登录")
						http.post('/api/member/wxMiniLogin',data).then(sres => {
							console.log(sres,"sres111")
							switch(sres.code){
								
								case 0:
								// console.log(8888)
									uni.setStorageSync('accessToken',sres.data.token);
									that.globalData.accessToken = sres.data.token;
										//  判断是否有用户信息头像昵称
									that.getUserInfo(function(Res){
										// that.globalData.inviteIndexflag = Res.vip_level>0?false:true;
										// that.globalData.isLoginFlag = Res.nick_name && Res.nick_name.indexOf('Gfner')<0 && sres.data.is_first_login === false ? true:false;
										that.globalData.mineInfo = Res;
										uni.setStorageSync('mineInfo',Res);
										resolve(Res);
									})
								break;
								default:
								// console.log(999)
									uni.showToast({
										title:sres.message,
										icon:'none'
									})
								break;
							}
						})
					}
				});
			},
			
			//  用户信息
			getUserInfo(resolve) {
				let that = this;
				apiGetMemberInfo().then(lRes =>{
					switch(lRes.code){
						case 0:
							uni.setStorageSync('mineInfo',lRes.data);
							resolve(lRes.data)
						break;
						case 61:
							//需要重新登录
							that.isLogin({},function(login){
								resolve(login)
							});
						break;
						default:
							uni.showToast({
								title:lRes.message,
								icon:'none'
							})
						break;
					}
				})
			},
			//  支付
			WxPayMentMed(parms,resolve,reject){
				// #ifdef MP-WEIXIN
					uni.requestPayment({
						provider: 'wxpay',
						timeStamp: parms.timestamp,
						nonceStr: parms.nonceStr,
						package: parms.package,
						signType: parms.signType,
						paySign: parms.paySign,
						success: function (res) {
							resolve(res);
						},
						fail: function (err) {
							reject(err);
						}
					})
				// #endif
				// #ifdef MP-TOUTIAO
					tt.pay({
						orderInfo: {
						    order_id: parms.orderId,
						    order_token:parms.orderToken,
						},
						  service: 5,
						  success(res) {
								console.log(res,'支付成共抖音')
								if (res.code == 0) {
									resolve(res);
								}
							},
							fail(err){
								console.error(err,'抖音支付失败')
								reject(err);
							}
					})
				// #endif
			},
			
			//  支付回调方法
			WxPayMent(parms){
				return new Promise((resolve, reject) => {
					uni.requestPayment({
						// provider: 'wxpay',
						timeStamp: parms.timeStamp,
						nonceStr: parms.nonceStr,
						package: parms.package,
						signType: parms.signType,
						paySign: parms.paySign,
						success: function (res) {
							resolve(res);
						},
						fail: function (err) {
							reject(err);
						}
					})
				})
			},
			//邀请页面分享图片
			GetShareImg(resolve){
				let that = this;
				uni.request({
					url:BASE_URL + '/develop/api/v1/system/setting/users_todo_relation_img',
					method:'GET',
					success(img) {
						resolve(img.data)
					},
					fail(fail) {
					}
				})
			},
			//邀请卡片分享图片
			GetShareCardImg(resolve){
				let that = this;
				uni.request({
					url: backendUrl + '/develop/api/v1/invite/img',
					// url: 'https://api.ynz666.com/develop/api/v1/invite/img',
					method:'GET',
					success(img) {
						resolve(img.data)
					}
				})
			},
			
			// 授权微信信息
			getUserProfile(resolve){
				let that = this;
				uni.getUserProfile({
					desc:'用于展示用户信息',
					success(com) {
						console.log('进来进来',com.userInfo)
						uni.setStorageSync('WxUserInfo',com.userInfo);
						
						// #ifdef MP-TOUTIAO
							let data = {
								nickName:com.userInfo.nickName,
								avatar:com.userInfo.avatarUrl
							};
							http.post('/api/v1/user/update',data).then(update => {
								switch( update.code ){
									case 200:
										that.globalData.isLoginFlag = true;
										//  判断是否有用户信息头像昵称
										that.getUserInfo(function(lRes){
											that.globalData.mineInfo = lRes;
											uni.setStorageSync('mineInfo',lRes);
											resolve(lRes);
										})
									break;
									default:
										uni.showToast({
											title:'用户信息授权失败',
											icon:"none",
											duration:2000
										})
									break;
								}
							});
						// #endif
						// #ifdef MP-WEIXIN
						  console.log(com,"XXXXXXXXXX")
						  console.log(com.iv,"XXXXXXXXXX",com.encryptedData)
							
							UserInfoUpDate({
								iv:com.iv,
								encrypted_data:com.encryptedData
							}).then( update => {
								switch( update.code ){
									case 200:
										that.globalData.isLoginFlag = true;
										//  判断是否有用户信息头像昵称
										that.getUserInfo(function(lRes){
											that.globalData.mineInfo = lRes;
											uni.setStorageSync('mineInfo',lRes);
											resolve(lRes);
										})
									break;
									default:
										uni.showToast({
											title:'用户信息授权失败',
											icon:"none",
											duration:2000
										})
									break;
								}
							});
						// #endif
					},
					fail(fail) {
						console.log(fail,'授权失败')
						uni.showToast({
							title: fail.errMsg == 'getUserProfile:fail auth deny'?'取消授权': '网络状况不佳，请稍候。',
							icon:"none",
							duration:2000
						})
					}
				})
			},
			
			// 小程序相册授权
			photosAblum(resolve){
				uni.getSetting({
					success(res) {
						if(res.authSetting['scope.writePhotosAlbum']){
							resolve()
						}else {
							wx.authorize({
								scope: 'scope.writePhotosAlbum',
								success () {
									resolve()
								},
								fail(err) {
									uni.showModal({
										title:'授权提示',
										content:'拒绝授权可能会导致图片无法保存到手机相册',
										confirmText:'立即授权',
										cancelText:'暂不授权',
										cancelColor:"#666",
										confirmColor:"#1AAD19",
										success(com) {
											if(com.confirm){
												uni.openSetting({
													success(set){
														console.log(set,'引导授权成功');
														if(set.authSetting['scope.writePhotosAlbum']){
															resolve()
														}
													},
												})
											}
										}
									})
								}
							})
						}
					}
				})
			},
			
		}
	}
</script>

<style lang="scss">
@import '@/utils/request/quill.core.css';
/*每个页面公共css */
view,text,input,button {
	font-family: PingFang SC;
}
button  {
	padding: 0!important;
	margin: 0!important;	
	border:none!important;
	border-radius: 0;
}
	
button::after {
	border:none!important;
	border-radius: 0;
}

.hover-btn  { /* 经过按钮hover样式 */
	background: rgba(247, 181, 0, 0.9);
}
.mask {
	width: 100vw;
	height: 100%;
	background: rgba(0, 0, 0, 0.5);
	position: fixed;
	top: 0;left: 0;
	z-index: 1;
}
/* 多行文本换行 */
.word-line-clamp3{
	overflow: hidden !important;
	text-overflow: ellipsis !important;
	display: -webkit-box !important;
	-webkit-line-clamp: 3;//文字上限行
	-webkit-box-orient: vertical;
	white-space: pre-wrap;
}
.word-line-clamp2{
	overflow: hidden !important;
	text-overflow: ellipsis !important;
	display: -webkit-box !important;
	-webkit-line-clamp: 2;//文字上限行
	-webkit-box-orient: vertical;
	white-space: pre-wrap;
}
.word-line-clamp1 {
	overflow: hidden !important;
	text-overflow: ellipsis !important;
	display: -webkit-box !important;
	-webkit-line-clamp: 1;//文字上限行
	-webkit-box-orient: vertical;
	word-break: break-all;
	white-space: pre-wrap;
	word-wrap: break-word;
}

.clearfix{
	zoom:1;
}
.clearfix:after{
    content:'clear';
    display:block;
    height:0;
    clear:both;
    overflow:hidden;
    visibility:hidden;
}

.list_none {
	width: 460rpx;
	height: 340rpx;
	font-size: 24rpx;
	text-align: center;
	color: #999999;
	margin: 0 auto;
	image {
		width: 460rpx;
		height: 340rpx;
	}
	view {
		margin-top: -50rpx;
	}
}
scroll-view {
	overflow-x: hidden!important;
	white-space: nowrap;
}

.modal-btn {
	width: 424rpx;
	height: 88rpx;
	background: #FADB14;
	border-radius: 44rpx;
	text-align: center;
	color: #fff;
	font-size: 28rpx;
	font-weight: bold;
	color: #FFFFFF;
	line-height: 88rpx;
}

// .filterImg {
// 	filter: grayscale(100%);
// }
</style>
<style>
	@import "/wxcomponents/vant/dist/common/index.wxss";
</style>